package com.demo.pattern.simplefactory.order;

import com.demo.pattern.simplefactory.pizza.CheesePizza;
import com.demo.pattern.simplefactory.pizza.GreekPizza;
import com.demo.pattern.simplefactory.pizza.PepperPizza;
import com.demo.pattern.simplefactory.pizza.Pizza;

/**
 * @author sourire
 * @version 1.0
 * @date 2020/8/18 11:46
 */
public class SimpleFactory {
    public static Pizza createPizza(String orderType){
        Pizza pizza = null;
        if(orderType.equals("greek")){
            pizza = new GreekPizza();
            pizza.setName("希腊披萨");
        }else if(orderType.equals("cheese")){
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");
        }else if(orderType.equals("pepper")){
            pizza = new PepperPizza();
            pizza.setName("胡椒披萨");
        }
        return pizza;
    }
}
